package com.taojiazheng.serviceImpl.myCreate;

import com.taojiazheng.dao.myCreate.MyCreateDao;
import com.taojiazheng.dao.user.UserDao;
import com.taojiazheng.entity.User;
import com.taojiazheng.mapper.JobMapper;
import com.taojiazheng.mapper.JobinfoMapper;
import com.taojiazheng.mapper.MycreateMapper;
import com.taojiazheng.service.myCreate.MyCreateService;
import com.taojiazheng.so.mycreate.MyCreateSo;
import com.taojiazheng.vo.myCreate.MyCreateVo;
import org.omg.CORBA.PRIVATE_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 赵成林
 * @date 2017/12/23 22:13
 */
@Service
public class MyCreateServiceImpl implements MyCreateService {
    @Autowired
    private MyCreateDao myCreateDao;
    @Autowired
    private JobMapper jobMapper;
    @Autowired
    private JobinfoMapper jobinfoMapper;
    @Autowired
    private MycreateMapper mycreateMapper;
    @Autowired
    private UserDao userDao;
    public List<MyCreateVo> getMyCreates(String token) {
        //return null;
        User user = userDao.getUserByToken(token);
        return  myCreateDao.getMycreates(user.getId());
    }

    /**
     * 岗位下架
     * @param myCreateSo
     */
    public void deleteMyCreate(MyCreateSo myCreateSo){
//        jobMapper.deleteMyCreate(myCreateSo.getJobId());
//        jobinfoMapper.deleteMyCreate(myCreateSo.getJobId());
        jobinfoMapper.updateIsDelete(myCreateSo.getJobId());
        mycreateMapper.deletMyCreate(myCreateSo.getJobId());
    }
}
